﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using CoreEx.Common.Proxy;

namespace CoreEx.Common.Implementation.Proxy
{
    public class InitalizationInfo : IInitalizationInfo
    {        
        public InitalizationInfo(object target, ConstructorInfo targetConstructor, StackTrace stackTrace, Type baseType, Type[] interfaces)
        {
                Target = target;
                TargetConstructor = targetConstructor;
                StackTrace = stackTrace;
                BaseType = baseType;
                Interfaces = interfaces;
        }

        public object Target { get; private set; }

        public ConstructorInfo TargetConstructor { get; private set;}
        

        public StackTrace StackTrace { get; private set;}
        
        public MethodBase CallingMethod 
        {
            get
            {
                var frame = StackTrace.GetFrame(0);
                return frame.GetMethod();
            }
        }

        public Type BaseType { get; private set; }

        public Type[] Interfaces { get; private set; }
        
    }
}